﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="WorkflowCensor.aspx.cs"
    Inherits="ZX.WebApp.WorkflowCensor" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>

    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />

    <link href="../../Styles/base.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/CombinButton.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/treeview/treeview-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
 
    <link href="../../Styles/table_style.css" rel="stylesheet" type="text/css" />
       <style type="text/css">

        body
        {
            font-family: 宋体, Arial, Helvetica, sans-serif;
            font-size: 12px;
            color: #333333;
            background-color: #FFFFFF;
            background: #ececec;

        }

    </style>
</head>
<body>
    <form id="form1" runat="server" class="uniForm">
    <div align="center"
        id="appMessge" runat="server">
        <%--审 批 信 息 列 表--%>
        <fieldset style="width: 89%;">
            <legend><font style="color: #082c50; font-family: 仿宋" class="style4">审 批 信 息</font></legend>
            <asp:Repeater ID="rptCheckInfo" runat="server">
                <HeaderTemplate>
                    <table class="TableList" cellspacing="0" rules="all" border="1" id="ctl06_gvAuditMessage"
                        style="width: 98%; border-collapse: collapse; word-break: break-all; word-wrap: break-word;">
                        <tr class="TableHeader" align="left">
                            <th scope="col">
                                任务名称
                            </th>
                            <th scope="col">
                                审批人
                            </th>
                            <%--                                <th scope="col">
                                    审批结果
                                </th>--%>
                            <th scope="col">
                                审批意见
                            </th>
                            <th scope="col">
                                任务到达时间
                            </th>
                            <th scope="col">
                                审批时间
                            </th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr class="TableData1">
                        <td style="width: 13%">
                            <%#Eval("TaskInstanceCaption")%>
                        </td>
                        <td style="width: 13%">
                            <%#Eval("OperatedDes")%>
                        </td>
                        <%--                            <td>
                                                                        <%#Eval("AuditResult") %>
                                                                    </td>--%>
                        <td style="width: 38%">
                            <%#Eval("Message")%>
                        </td>
                        <td style="width: 18%">
                            <%#Eval("taskStartTime")%>
                        </td>
                        <td style="width: 18%">
                            <%#Eval("taskEndTime")%>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    </table></FooterTemplate>
            </asp:Repeater>
          
                <asp:TextBox ID="lbOperatorInsId" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
                <asp:TextBox ID="lbWorktaskInsId" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
                <asp:TextBox ID="lbWorktaskId" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
                <asp:TextBox ID="lbWorkflowInsId" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
                <asp:TextBox ID="lbWorkflowId" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
                <asp:TextBox ID="lbAuditId" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
                 <asp:TextBox ID="lbStatus" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
                  <asp:TextBox ID="lblUserNames" runat="server"  TextMode="MultiLine"
                                Style="display: none" ></asp:TextBox>
            
                <table  id="tdApproval" runat="server" align="center" class="TableBlock" width="98%" cellspacing="0" height="18" >
                    <tr valign="top">
                        <td align="left" class="TableData">
                            <strong>审批人: </strong>
                        </td>
                        <td align="left" class="TableContent" colspan="2">
                            <asp:Label ID="lbUserName" runat="server" ></asp:Label>
                        </td>
                        <td align="left" class="TableData">
                            <strong>审批时间: </strong>
                        </td>
                        <td align="left" class="TableContent" colspan="1">
                            <asp:Label ID="lbAuditTime" runat="server" Text="lbAuditTime"></asp:Label>
                        </td>
                    </tr>
                    <tr style="display: none">
                        <td align="left" class="TableData" valign="top">
                            <asp:Label ID="Label5" runat="server" Text="部门:" Width="70px"></asp:Label>
                        </td>
                        <td align="left" class="TableContent" colspan="2">
                            <asp:Label ID="lbArch" runat="server" Text="lbArch" Width="104px"></asp:Label>
                        </td>
                        <td align="left" class="TableData">
                            <asp:Label ID="Label7" runat="server" Text="职务:"></asp:Label>
                        </td>
                        <td align="left" class="TableContent" colspan="4" style="height: 21px">
                            <asp:Label ID="lbDuty" runat="server" Text="lbDuty" Width="160px"></asp:Label>
                        </td>
                    </tr>
      
                    <tr valign="top">
                        <td align="left" class="TableData" valign="top">
                            <strong>审批意见: </strong>
                        </td>
                        <td align="left" class="TableContent" colspan="6" style="height: 21px">
                            <asp:TextBox ID="tbxMessage" runat="server" Height="73px" Rows="3" TextMode="MultiLine"
                                Width="96%"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                                <td align="left" class="TableData" width="90">
                                    &nbsp;<label runat="server" id="lbltext">转发处理者:</label>
                                </td>
         
                                <td align="left" class="TableContent" colspan="6" >
                                    <input type="hidden" id="TransmitId" runat="server" name="TransmitId" />
                                    <input id="txtTransmitId" runat="server" readonly="readonly" name="txtTransmitId"
                                        type="text" style="width: 150px" />
                                    <button id="btnTransmitId" name="5" runat="server" type="button" class="btnCheck"
                                        style="width: 60px">
                                        选择</button>
                                </td>
                            </tr>
                </table>
  
        </fieldset>


        <table style="display: none;">
            <tr>
                <td width="90px">
                    &nbsp;指定处理人员：
                </td>
                <td align="left">
                    <input type="hidden" id="CustomId" runat="server" name="CustomId" />
                    <input id="txtCustomId" runat="server" readonly="readonly" name="txtCustomId" type="text"
                        style="width: 150px" />
                    <button id="btnCustomId" name="X1" type="button" runat="server" class="btnCheck"
                        style="width: 30px">
                        选择</button>
                </td>
            </tr>
        </table>
    </div>

    <asp:LinkButton ID="LinkButton1" runat="server" Style="display: none" OnClick="LinkButton1_Click">.</asp:LinkButton>
    <script type="text/javascript">
        var istransmit = '<%=Istransmit%>';
        var userid = '<%=nowuser%>';
        var message = '<%=CtrlState %>';
        function Checking() {
            var contents = document.getElementById('tbxMessage').value;
            if (contents == null || contents == "") {
                alert("请填写审批意见！");
                if (parent.document.getElementById('btnPagereturn') != null) {
                    parent.document.getElementById('btnPagereturn').disabled = false;
                }
            }
            if (contents != null && contents != "") {
                var transmitId = document.getElementById('TransmitId').value;
                var txttransmit = "";
                var lbWorkflowId = document.getElementById('lbWorkflowId').value;
                var lbWorktaskId = document.getElementById('lbWorktaskId').value;
                var lbWorkflowInsId = document.getElementById('lbWorkflowInsId').value;
                var lbWorktaskInsId = document.getElementById('lbWorktaskInsId').value;
                var lbAuditId = document.getElementById('lbAuditId').value;
                var lbOperatorInsId = document.getElementById('lbOperatorInsId').value;
                var lbUserName = document.getElementById('lblUserNames').value;
                var lbStatus = document.getElementById('lbStatus').value;
                var tbxMessage = document.getElementById('tbxMessage').value;
                if (transmitId != "") {
                    txttransmit = document.getElementById('txtTransmitId').value;
                }
                $.ajax({
                    type: "POST",
                    cache: false,
                    async: false,
                    url: "WorkflowCensor.aspx?Action=" + transmitId + "&WorkflowId=" + lbWorkflowId + "&WorktaskId=" + lbWorktaskId + "&WorkflowInsId=" + lbWorkflowInsId + "&WorktaskInsId=" + lbWorktaskInsId + "&AuditId=" + lbAuditId + "&OperatorInsId=" + lbOperatorInsId + "&UserName=" + encodeURI(lbUserName) + "&Message=" + encodeURI(tbxMessage) + "&Status=" + encodeURI(lbStatus) + "&txtusername=" + encodeURI(txttransmit) + "",
                    data: {},
                    dataType: "json",
                    success: function (result) {

                    }
                });
                return "1";
            }
            alert(istransmit);
        }
        function Check(str) {
            var IsCheck = '1';
            if (message != "1") {
                var contents = document.getElementById('tbxMessage').value;
                //var transmit = document.getElementById('txtTransmitId').value;
                var loginname = document.getElementById('TransmitId').value;
                var userloginname = document.getElementById('TransmitId').value.split(",");
                if (str == "0") {
                    if (loginname == "") {
                        alert("转发处理者不能为空,请选择转发处理者！");
                        if (parent.document.getElementById('btnPagereturn') != null) {
                            parent.document.getElementById('btnPagereturn').disabled = false;
                        }
                        IsCheck = '0';
                    }
                    else if (contents == null || contents == "") {
                        alert("请填写审批意见！");
                        if (parent.document.getElementById('btnPagereturn') != null) {
                            parent.document.getElementById('btnPagereturn').disabled = false;
                        }
                        IsCheck = '0';
                    }
                    else {
                        IsCheck = '1';
                    }
                    for (i = 0; i < userloginname.length; i++) {
                        if (userid == userloginname[i]) {
                            alert("不能转发当前人");
                            IsCheck = '0';
                        }
                    }
                }
                else if (str == "1")
                 {
                     if (contents == null || contents == "") {

                         alert("请填写审批意见！");
                         if (parent.document.getElementById('btnPagereturn') != null) {
                             parent.document.getElementById('btnPagereturn').disabled = false;
                         }
                         IsCheck = '0';
                     }
                     else if (loginname != "") {
                         alert("点击批准时,转发处理者不能有人！");
                         if (parent.document.getElementById('btnPagereturn') != null) {
                             parent.document.getElementById('btnPagereturn').disabled = false;
                         }
                         IsCheck = '0';
                     }
                     else {
                         IsCheck = '1';
                     }
                 }
               
            }
            return IsCheck;
        }
        function Save() {
            if (message != "1") {
                var content = document.getElementById('tbxMessage').value;
                var appoint = document.getElementById('txtCustomId').value;   //todo zhuyun
                var costomid = document.getElementById('CustomId').value;

                var tcostomid = document.getElementById('TransmitId').value;
                if (costomid != "" && tcostomid != "") {
                    alert('转发和指定人员不能同时存在！');
                    if (parent.document.getElementById('btnCensorSubmit') != null) {
                        parent.document.getElementById('btnCensorSubmit').disabled = false;
                    }
                    return;
                }
                if (content == "" || content == null) {
                    alert("请填写审批意见！");
                    if (parent.document.getElementById('btnCensorSubmit') != null) {
                        parent.document.getElementById('btnCensorSubmit').disabled = false;
                    }
                    return "1";
                }
            }
            if (content != null && content != "" || message == "1") {
                var transmitId = document.getElementById('TransmitId').value;
                var txttransmit = "";
                var lbWorkflowId = document.getElementById('lbWorkflowId').value;
                var lbWorktaskId = document.getElementById('lbWorktaskId').value;
                var lbWorkflowInsId = document.getElementById('lbWorkflowInsId').value;
                var lbWorktaskInsId = document.getElementById('lbWorktaskInsId').value;
                var lbAuditId = document.getElementById('lbAuditId').value;
                var lbOperatorInsId = document.getElementById('lbOperatorInsId').value;
                var lbUserName = document.getElementById('lblUserNames').value;
                var lbStatus = document.getElementById('lbStatus').value;
                var tbxMessage = document.getElementById('tbxMessage').value;
                if (transmitId != "") {
                     txttransmit = document.getElementById('txtTransmitId').value;
                 }
                $.ajax({
                    type: "POST",
                    cache: false,
                    async: false,
                    url: "WorkflowCensor.aspx?Action=" + transmitId + "&WorkflowId=" + lbWorkflowId + "&WorktaskId=" + lbWorktaskId + "&WorkflowInsId=" + lbWorkflowInsId + "&WorktaskInsId=" + lbWorktaskInsId + "&AuditId=" + lbAuditId + "&OperatorInsId=" + lbOperatorInsId + "&UserName=" + encodeURI(lbUserName) + "&Message=" + encodeURI(tbxMessage) + "&Status=" + encodeURI(lbStatus) + "&txtusername=" + encodeURI(txttransmit) + "",
                    data: {},
                    dataType: "json",
                    success: function (result) {

                    }
                });
              
            }

            parent.hanYesno(costomid);



        }
        YAHOO.namespace("example.container");


        //        function ShowDialog3(fn, id) {
        //            document.getElementById('dialog3').style.display = "";
        //            var handleSubmit = function () {
        //                var editwindow = document.getElementById("EditUIWindow3");
        //                if (editwindow) {
        //                    editwindow.contentWindow.ChooseInfo();
        //                }
        //                YAHOO.example.container.dialog3.hide();
        //            };
        //            var handleCancel = function () {
        //                this.cancel();
        //            };
        //            var handleSuccess = function (o) {
        //                var response = o.responseText;
        //                response = response.split("<!")[0];
        //                document.getElementById("resp").innerHTML = response;
        //            };
        //            var handleFailure = function (o) {
        //                alert("Submission failed: " + o.status);
        //                //                  var response = o.responseText;
        //                //                  response = response.split("<!")[0];
        //                //                  document.getElementById("resp").innerHTML = response;
        //            };
        //            var handleFailure = function (o) {
        //                alert('出错了handleFailure');
        //            };
        //            
        //            var const_EditWindowWidth = "400px",
        //		    const_EditWindowHeight = "300px";
        //            // Remove progressively enhanced content class, just before creating the module
        //            YAHOO.util.Dom.removeClass("dialog3", "yui-pe-content");

        //            // Instantiate the Dialog
        //            YAHOO.example.container.dialog3 = new YAHOO.widget.Dialog("dialog3",
        //							    { width: const_EditWindowWidth,
        //							        height: const_EditWindowHeight,
        //							        fixedcenter: true,
        //							        visible: false,
        //							        draggable: true,
        //							        close: true,
        //							        autofillheight: "body",
        //							        constraintoviewport: true,
        //							        buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
        //								          { text: "取消", handler: handleCancel}]
        //							    });
        //            // Wire up the success and failure handlers
        //            YAHOO.example.container.dialog3.callback = { success: handleSuccess,
        //                failure: handleFailure
        //            };
        //            // Render the Dialog
        //            YAHOO.example.container.dialog3.render();
        //                        _fn = fn;
        //                        _id = id;
        //            YAHOO.example.container.dialog3.show();
        //        }
 
    </script>
    </form>
</body>
</html>
